package demo2;

import com.alibaba.csp.sentinel.slots.block.flow.FlowRule;
import com.alibaba.csp.sentinel.slots.block.flow.FlowRuleManager;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import java.util.ArrayList;
import java.util.List;

@SpringBootApplication
public class Demo1Main {
    public static void main(String[] args) {
        SpringApplication.run(Demo1Main.class,args);

        List<FlowRule> flowRules = new ArrayList<>();
        FlowRule flowRule = new FlowRule();
        flowRule.setResource("sayHi1");
        flowRule.setCount(1);
        flowRule.setGrade(1);
        flowRules.add(flowRule);
        //sentinel读取规则数据
        FlowRuleManager.loadRules(flowRules);
    }
}
